package com.hoodbrains.insideloc.utils;

import android.view.View;

public class ItemHolder<T> {

	public T getItem() {
		return item;
	}

	public void setItem(T item) {
		this.item = item;
	}

	public int getPosition() {
		return position;
	}

	public void setPosition(int position) {
		this.position = position;
	}

	public long getId() {
		return id;
	}

	public void setId(long id) {
		this.id = id;
	}



	private T item;
	private int position;
	private long id;
	
	public ItemHolder(T item, int position) {
		this.item = item;
		this.position = position;
	}
	
	public ItemHolder(T item, int position, long id) {
		this(item, position);
		this.id = id;
	}
	
	
	@SuppressWarnings("unchecked")
	public static <T> ItemHolder<T> getItemHolder(View v) {
		return (ItemHolder<T>)v.getTag();
	}
	
	public static <T> T getItem(View v) {
		ItemHolder<T> iH = ItemHolder.<T>getItemHolder(v);
		return iH.getItem();
	}
	
}
